package stool.observerpattern.part1;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author Felix YF Dong
 * @Date 2021/5/7
 */
public class Boss extends Subject{

    private final List<Observer> observers = new ArrayList<>();

    @Override
    public void attach(Observer observer) {
        observers.add(observer);
    }

    @Override
    public void detach(Observer observer) {
        observers.remove(observer);
    }

    @Override
    public void nofifyInfo() {
        observers.forEach(Observer::update);
    }
}
